# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=librevenge

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.0.1
pkgrel=1
pkgdesc="library for REVerses ENGineered formats filters (mingw-w64)"
arch=('any')
url="ttp://sf.net/p/libwpd/librevenge/"
license=("MPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" "${MINGW_PACKAGE_PREFIX}-boost")
checkdepends=("${MINGW_PACKAGE_PREFIX}-cppunit")
options=(staticlibs strip)
source=("http://sourceforge.net/projects/libwpd/files/librevenge/${_realname}-${pkgver}/${_realname}-${pkgver}.tar.xz")
md5sums=('7c397d6eb39d906dacacd74cc1f0d749')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
}

build() {
  export lt_cv_deplibs_check_method='pass_all'
  cp -r ${srcdir}/${_realname}-${pkgver} "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --enable-static \
    --with-boost-filesystem=boost_filesystem-mt
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="$pkgdir" install
  find "${pkgdir}${MINGW_PREFIX}" -name '*.def' -o -name '*.exp' | xargs -rtl1 rm
}
